package com.yidu.ruifeng_logistics.service.impl;

import com.yidu.ruifeng_logistics.entity.LogisticsLog;
import com.yidu.ruifeng_logistics.dao.LogisticsLogDao;
import com.yidu.ruifeng_logistics.service.LogisticsLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (LogisticsLog)表服务实现类
 *
 * @author makejava
 * @since 2021-03-09 14:24:40
 */
@Service("logisticsLogService")
public class LogisticsLogServiceImpl implements LogisticsLogService {
    @Resource
    private LogisticsLogDao logisticsLogDao;

    /**
     * 通过ID查询单条数据
     *
     * @param logId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsLog queryById(Integer logId) {
        return this.logisticsLogDao.queryById(logId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsLog> queryAllByLimit(int offset, int limit) {
        return this.logisticsLogDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsLog 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsLog insert(LogisticsLog logisticsLog) {
        this.logisticsLogDao.insert(logisticsLog);
        return logisticsLog;
    }

    /**
     * 修改数据
     *
     * @param logisticsLog 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsLog update(LogisticsLog logisticsLog) {
        this.logisticsLogDao.update(logisticsLog);
        return this.queryById(logisticsLog.getLogId());
    }

    /**
     * 通过主键删除数据
     *
     * @param logId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer logId) {
        return this.logisticsLogDao.deleteById(logId) > 0;
    }

    @Override
    public List<LogisticsLog> queryAll(LogisticsLog logisticsLog) {
        return this.logisticsLogDao.queryAll(logisticsLog);
    }

}
